package net.hn.hnms.biz.common.jpa.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 智呈物联 pan'sx
 * 2022/7/26 10:28
 * 1.0 version
 */
@Getter
@Setter
@ApiModel(value = "分页响应对象", description = "分页响应对象")
public class ResponsePage<T> {
    @ApiModelProperty(value = "当前页数据")
    private List<T> pageData = new ArrayList<>();
    @ApiModelProperty(value = "总条数")
    private int count = 0;

    public ResponsePage(Map map) {
        this.pageData = (List<T>) map.get("content");
        this.count = (int) map.get("totalElements");
    }
    public ResponsePage(List list, int count) {
        this.pageData=list;
        this.count=count;
    }
}